package com.example.other.mapper;

import com.example.other.domain.VO.RankVO;
import com.example.other.domain.dto.SetmealdetailDto;
import com.example.other.domain.Setmeal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author Limhuang
* @description 针对表【setmeal】的数据库操作Mapper
* @createDate 2024-07-03 10:15:00
* @Entity com.example.other.domain.Setmeal
*/
public interface SetmealMapper extends BaseMapper<Setmeal> {
    List<SetmealdetailDto> getSetmealDetailBySex(@Param("type") Integer type);

    @Select("SELECT `name`,COUNT(`name`) total FROM orders NATURAL JOIN setmeal WHERE orders.state=1 GROUP BY setmeal.`name` ORDER BY total DESC")
    List<RankVO> getSetmealRank();

}




